package com.thb.pay.api.sys;


import com.thb.pay.core.utils.PageResult;
import com.thb.pay.vo.req.SysConfigPageReq;
import com.thb.pay.vo.req.SysConfigReq;
import com.thb.pay.vo.resp.SysConfigVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 * 系统-配置表 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@FeignClient(value = "pay-service", fallbackFactory = SysConfigServiceApiFallbackFactory.class)
@RequestMapping("/sysConfigApi")
public interface SysConfigServiceApi {

    /**
     * @param pageReq 分页参数
     * @Description 分页配置信息
     * @Author lucky
     * @data 2019/7/21 22:10
     */
    @RequestMapping(value = "/findPage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    PageResult<SysConfigVo> findPage(@RequestBody SysConfigPageReq pageReq);


    /**
     * @param type 配置类型
     * @Description 获取配置类型信息列表
     * @Author lucky
     * @data 2019/7/30 23:42
     */
    @RequestMapping(value = "/findListByType", method = RequestMethod.GET)
    List<SysConfigVo> findListByType(@RequestParam("type") String type);

    /**
     * @param code
     * @Description 获取code配置信息详情
     * @Author lucky
     * @data 2019/7/30 23:47
     */
    @RequestMapping(value = "/getByCode", method = RequestMethod.GET)
    SysConfigVo getByCode(@RequestParam("code") String code);


    /**
     * @param configReqList
     * @Description 更新配置信息
     * @Author lucky
     * @data 2019/7/30 23:48
     */
    @RequestMapping(value = "/updateAll", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void updateAll(@RequestBody List<SysConfigReq> configReqList);

    /**
     * @param configReq 配置信息
     * @Description 保存系统配置信息
     * @Author lucky
     * @data 2019/7/30 23:48
     */
    @RequestMapping(value = "/save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void save(@RequestBody SysConfigReq configReq);
}
